package cn.iocoder.yudao.module.erp.service.dpeast;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.erp.controller.admin.dpitem.dpeastlistbj.vo.DpEastListBjPageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.dpitem.dpeastlistbj.vo.DpEastListBjSaveReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.dplist.DpEastListBjDO;
import cn.iocoder.yudao.module.erp.dal.mysql.dpeast.DpEastListBjMapper;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;

import javax.annotation.Resource;

import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.erp.enums.ErrorCodeConstants.*;

/**
 * 北疆口岸仓东线清单 Service 实现类
 * @author 天使管理员
 */
@Service
@Validated
public class DpEastListBjServiceImpl implements DpEastListBjService {

    @Resource
    private DpEastListBjMapper dpEastListBjMapper;

    @Override
    public Long createDpEastListBj(DpEastListBjSaveReqVO createReqVO) {
        // 插入
        DpEastListBjDO dpEastListBj = BeanUtils.toBean(createReqVO, DpEastListBjDO.class);
        dpEastListBjMapper.insert(dpEastListBj);
        // 返回
        return dpEastListBj.getId();
    }

    @Override
    public void updateDpEastListBj(DpEastListBjSaveReqVO updateReqVO) {
        // 更新
        DpEastListBjDO updateObj = BeanUtils.toBean(updateReqVO, DpEastListBjDO.class);
        dpEastListBjMapper.updateById(updateObj);
    }

    @Override
    public void deleteDpEastListBj(Long id) {
        dpEastListBjMapper.deleteById(id);
    }

    @Override
    public DpEastListBjDO getDpEastListBj(Long id) {
        return dpEastListBjMapper.selectById(id);
    }

    @Override
    public PageResult<DpEastListBjDO> getDpEastListBjPage(DpEastListBjPageReqVO pageReqVO) {
        return dpEastListBjMapper.selectPage(pageReqVO);
    }

}